﻿Shader "Custom/anaglyphSteoro"
{
	Properties
	{
		_LCamTex("LeftCameraTexture", 2D) = "white" {}
		_RCamTex("RightCameraTexture", 2D) = "white" {}
		_ScreenWidth("ScreenWidth", float) = 1920
		_ScreenHeight("ScreenHeight", float) = 1080
	}
		SubShader
		{
			// No culling or depth
			Cull Off ZWrite Off ZTest Always

			Pass
		{
			CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag

	#include "UnityCG.cginc"

			struct appdata
		{
			float4 vertex : POSITION;
			float2 uv : TEXCOORD0;
		};

		struct v2f
		{
			float2 uv : TEXCOORD0;
			float4 vertex : SV_POSITION;
		};

		v2f vert(appdata v)
		{
			v2f o;
			o.vertex = UnityObjectToClipPos(v.vertex);
			o.uv = v.uv;
			return o;
		}

		sampler2D _LCamTex;
		sampler2D _RCamTex;
		float _ScreenWidth;
		float _ScreenHeight;

		fixed4 frag(v2f i) : SV_Target
		{
			fixed4 col;

		float4 Color1,Color2;
		Color2 = tex2D(_LCamTex, float2(i.uv.x/2, i.uv.y));

		Color1 = tex2D(_RCamTex, float2(i.uv.x/2, i.uv.y));

		Color1.r = Color2.r;
		Color1.g = Color1.g;
		Color1.b = Color1.b;
		Color1.a = 1;

		return Color1; 

	}
		ENDCG
	}
		}
}
